package com.jlastu.znb.entity;

import java.util.ArrayList;
import java.util.List;

public class Goods {
   int id;
   String name;
   double price;
   String unit;
   String message;
   List<Photo> photoList;

   public int getId() {
      return id;
   }

   public void setId(int id) {
      this.id = id;
   }

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public double getPrice() {
      return price;
   }

   public void setPrice(double price) {
      this.price = price;
   }

   public String getUnit() {
      return unit;
   }

   public void setUnit(String unit) {
      this.unit = unit;
   }

   public String getMessage() {
      return message;
   }

   public void setMessage(String message) {
      this.message = message;
   }

   public List<Photo> getPhotoList() {
      return photoList;
   }

   public void setPhotoList(List<Photo> photoList) {
      this.photoList = photoList;
   }

   public void addPhoto(Photo photo) {
      if (photoList == null) {
         photoList = new ArrayList<>();
      }
      photoList.add(photo);
   }

   @Override
   public String toString() {
      return "Goods{" +
              "id=" + id +
              ", name='" + name + '\'' +
              ", price=" + price +
              ", unit='" + unit + '\'' +
              ", message='" + message + '\'' +
              ", photoList=" + (photoList == null ? null : photoList.size()) +
              '}';
   }
}
